Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql/jobs: fix races in TestRegistryResumeExpiredLease #20635

Merged
merged 1 commit into from
Dec 13, 2017
Merged

sql/jobs: fix races in TestRegistryResumeExpiredLease #20635

merged 1 commit into from
Dec 13, 2017

Conversation

maddyblue
Copy link
Contributor

Release note: None

Sometimes jobs will resume more times than usual. Move lock and
unlocking to places to prevent deadlocks. Move the done close to
a place that will allow all jobs to proceed without receiving from
resumeCalled.

Fixes #20623

@maddyblue maddyblue requested a review from benesch December 11, 2017 21:57
@cockroach-teamcity
Copy link
Member

This change is Reviewable

testutils.SucceedsSoon(t, func() error {
lock.Lock()
if e, a := 2, resumeCounts[jobMap[3]]; e != a {
defer lock.Unlock()
if e, a := 2, resumeCounts[jobMap[3]]; e > a {
return errors.Errorf("expected resumeCount to be %d, but got %d", e, a)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally the error message would be updated a la expected hookCallCount to be > %d, but got %d.

Release note: None

Sometimes jobs will resume more times than usual. Move lock and
unlocking to places to prevent deadlocks. Move the done close to
a place that will allow all jobs to proceed without receiving from
resumeCalled.

Fixes #20623
@maddyblue maddyblue merged commit 48f354e into cockroachdb:master Dec 13, 2017
@maddyblue maddyblue deleted the job-lock branch December 13, 2017 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql/jobs: TestRegistryResumeExpiredLease flake
3 participants